#ifndef RAIN_H_
#define RAIN_H_

#include "sceneObject.h"
#include "model/actions/gravity.h"
#include "rainDrop.h"

class Rain : public SceneObject{
	private:
		static const unsigned int lightningCount;
		static const unsigned int lightningActivateTickCount;
		unsigned int tickCount;

		bool stopped;
		float density;
		Gravity& gravity;

		ObjectModelPtr lightningModel;
		std::vector<SceneObject*> lightning;
		std::list<SceneObject*> drops;

		void activateLightning();
		void createLightning(Point sceneCenter);
	public:
		Rain(const Cube& cube,float density,Point sceneCenter,Gravity& g,const ObjectModelPtr& dropModel,const ObjectModelPtr& lightningModel);

		~Rain();

		void destroyCollidedDrops();
		void generateDrops();

		void move(float dx,float dy,float dz);

		void timeStep();

		void stop();
		void start();

		void setModelMatrix();
		void setSubModelMatrix(const std::string& name="");

		static std::string name(){
			return "rain";
		}
};

#endif /* RAIN_H_ */
